Co-pending U.S. patent application Ser. No. 12/847,925 entitled ASSUMPTION-BASED OPTIMIZATION, filed concurrently herewith, the entire disclosure of which is incorporated herein by reference for all purposes, discloses optimizing a compiled code based on an assumption, for example, and testing at runtime to ensure, prior to executing the optimized code, whether the assumption is true. Such a technique may be used, for example, to create a more efficient compiled version of software code written in a dynamic and flexible scripting and/or other programming language, such as JavaScript®.
“Inlining” is a technique that may be used in suitable circumstances to optimize compiled code. The technique typically involves optimizing calls from one function to another by replacing the portion of code that makes a function call with a direct incorporation of the source or compiled code instructions corresponding to the function being called. Inlining a called function avoids the overhead associated with the function being called and a result being returned, for example, and may enable further optimizations of the resulting code to be identified and/or performed. For non-dynamic programming languages, for example, it may be possible and correct to assume that a called function will at runtime not be different than the function as it is defined in source or other code from which instructions associated with the function have been copied, for example to inline the function. However, for a dynamic language, such as JavaScript®, in which a function, operation, or other user or vendor supplied code may be deleted, modified, replaced, etc. at a later time, for example at runtime, it may not necessarily be the case that at runtime a function that has been inlined will be the same as the function as defined at the time the inlining was performed.